package com.kikcn.demo.domain;

import javax.persistence.*;
import java.io.Serializable;
import java.util.List;
import java.util.Set;

/**
 * Created by kikcn on 2015/4/18.
 */
@Entity
@Table(name="roles")
public class Role extends Base implements Serializable {
    @Column
    private String name;
    @Column
    private boolean enable;

    @OneToMany(fetch = FetchType.LAZY)
    @JoinTable(name = "roles_resources", joinColumns = {
            @JoinColumn(name = "rid", referencedColumnName = "id")
    }, inverseJoinColumns = {
            @JoinColumn(name = "rsid", referencedColumnName = "id")})
    private Set<Resource> resources;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public boolean isEnable() {
        return enable;
    }

    public void setEnable(boolean enable) {
        this.enable = enable;
    }

    public Set<Resource> getResources() {
        return resources;
    }

    public void setResources(Set<Resource> resources) {
        this.resources = resources;
    }
}
